package org.example.spring_frist.Wbook;

import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@NoArgsConstructor
@AllArgsConstructor
@Service
public class bookServer {
    int id = 0;

    @Primary
    @Bean
    bookServer b() {
        System.out.println("注册bean b1");
        return new bookServer();
    }

    @Qualifier("hh")
    @Bean
    bookServer b2() {
        System.out.println("注册bean b2");
        return new bookServer();
    }

    @Bean
    bookServer b3() {
        System.out.println("注册bean b3");
        return new bookServer(11);
    }

    public int getId() {
        return id;
    }

}
